<?php

include dirname(dirname(dirname(__FILE__))) . '/include/common.php';

class webServiceGetBudgetItem extends core {

    public function process() {
        $budget_item_id = isset($_POST['budget_item_id'])? intval($_POST['budget_item_id']) : 0 ;
        $user_id = intval($_POST['user_id']);
        $data = $this->db->get_row("SELECT * FROM budget_items WHERE item_id=$budget_item_id AND `user_id`='$user_id'");
        if ($data) {
 
            $this->_JSONResponse(array('error' => 0, 'item' => $data->item_name, 
                'amount' => $data->item_amount              
                ));
        } else {
            $this->_JSONResponse(array('error' => 1,'msg'=>'Item does not exist'));
        }
    }

}

$processor = new webServiceGetBudgetItem();
$processor->process();
?>